package es.ats.codington.web.servlets;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import es.ats.codington.festival.domain.Event;
import es.ats.codington.festival.domain.Place;
import es.ats.codington.festival.domain.Visitor;
import es.ats.codington.festival.services.EventService;
import es.ats.codington.festival.services.PlaceService;
import es.ats.codington.festival.services.VisitorService;
/**
 * Servlet implementation class ViewEventServlets
 */
@WebServlet("/ViewPlaceServlet")
public class ViewPlaceServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ViewPlaceServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PlaceService ps = new PlaceService();
		try{
			int idplace = Integer.parseInt(request.getParameter("idplace"));
			Place place = ps.viewPlace(idplace);
			request.setAttribute("place", place);
			RequestDispatcher dispatcher = request
	                .getRequestDispatcher("/viewplace.jsp"); 
			if (dispatcher != null){  
			      dispatcher.forward(request, response);  
			   }
			
											
		   
		   
			}catch(Exception ex){
				ex.getMessage();
				
			}
		 
		
		 
		 
	} 
	

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	    
	}

}

